Release 10.1A: OpenEdge Development:
Web Services
DatatypeFormats sample walk-through
DatatypeFormats.pfollows these steps to prepare, call, and process the output fromMultiDatatypes( )(source code edited and formatted for clarity):
- Creates a Web service object in the 4GL:
- Connects to the Web service (which has only one valid service and port):
- Sets the handle to the port type in the WSDL where the
MultiDatatypes( )operation is defined:
- Creates the XML document used to pass the input complex type parameter as a
LONGCHAR. This operation requires that theINPUTandOUTPUTparameters are XML documents because the Web service SOAP format is Document/Literal. The Web service expects the XML document input parameter to have this structure:
This is a sample of the code showing the
booleanvalue of the first parameter and thegYearMonthvalue of the last parameter added to the newly-created XML document:
- Saves the XML document
INPUTparameter as aLONGCHAR:
- Invokes the
MultiDatatypes( )operation of the Web service by making a procedure call:
- Checks for errors and manages the information for any that occur (see the "Common procedure for SOAP fault handling" section):
- If there are no errors, loads the XML document that was passed back in the
OUTPUTparameter:
The Web service returns the output XML document with the following structure:
- Parses the XML document, with the following code showing how values are retrieved for the
booleanvalue of the first parameter and thegYearMonthvalue of the last parameter of the complex type:
- Displays the data that was extracted from the XML:
- Cleans up by running this code:
Which:
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |